home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STGRPHMD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  841 b   |  30 lines

  1. #include <graphics.h>
  2.  
  3. main()
  4. {
  5.    int graphdriver = DETECT, graphmode,
  6.        lomode, himode, mode, c;
  7.    char buffer[80];
  8.  
  9. /* Detect and initialize graphics system */
  10.    initgraph(&graphdriver, &graphmode, "c:\\turboc");
  11.  
  12. /* Now call getmoderange to determine the range of
  13.  * modes supported by this adapter. Switch to each
  14.  * mode and draw a filled box in each mode.
  15.  */
  16.  
  17.    getmoderange(graphdriver, &lomode, &himode);
  18.    for(mode = lomode; mode <= himode; mode++)
  19.    {
  20.       setgraphmode(mode);
  21.       sprintf(buffer,"Now in graphics mode %d", mode);
  22.       outtextxy(10,10, buffer);
  23.       setfillstyle(SOLID_FILL,RED);
  24.       bar(50,50, 150,100);
  25.       outtextxy(10, getmaxy() - 50, "Press 'q' to exit, or any other key"
  26.       "to switch mode");
  27.       if((c = getch()) == 'q') break;
  28.    }
  29.    closegraph();
  30.  }